﻿'Option Strict Off
Option Explicit On
Imports System

Imports System.Data.Common

Namespace fctrDSTableAdapters
    Partial Public Class FundCentersTableAdapter
        Inherits System.ComponentModel.Component

        Public Function GetDataByFilter(ByVal dataTable As fctrDS.FundCentersDataTable, ByVal SQLExpression As String) As Integer
            Dim OriginalCommandText As String
            OriginalCommandText = Me.CommandCollection(0).CommandText
            Dim timeout As Integer
            Dim newtime As Integer = timeout
            Try
                newtime = Val(ConfigurationManager.AppSettings("QueryTimeOut"))
            Catch ex As Exception
                newtime = timeout
            End Try
            timeout = Me.CommandCollection(0).CommandTimeout
            Try
                Me.CommandCollection(0).CommandText = SQLExpression
                Me.CommandCollection(0).CommandTimeout = newtime
                Return Me.Fill(dataTable)
            Catch ex As Exception

            Finally
                Me.CommandCollection(0).CommandText = OriginalCommandText
                Me.CommandCollection(0).CommandTimeout = timeout
            End Try
        End Function

    End Class

    Partial Public Class fcth_viewTableAdapter
        Inherits System.ComponentModel.Component

        Public Function GetDataByFilter(ByVal dataTable As fctrDS.fcth_viewDataTable, ByVal SQLExpression As String, ByVal username As String, ByVal planyear As Integer) As Integer
            Dim OriginalCommandText As String
            OriginalCommandText = Me.CommandCollection(0).CommandText
            Dim timeout As Integer
            Dim newtime As Integer = timeout
            Try
                newtime = Val(ConfigurationManager.AppSettings("QueryTimeOut"))
            Catch ex As Exception
                newtime = timeout
            End Try
            timeout = Me.CommandCollection(0).CommandTimeout
            Try
                Me.CommandCollection(0).CommandText += SQLExpression
                Me.CommandCollection(0).CommandTimeout = newtime
                Return Me.Fill(dataTable, username, planyear)
            Catch ex As Exception

            Finally
                Me.CommandCollection(0).CommandText = OriginalCommandText
                Me.CommandCollection(0).CommandTimeout = timeout
            End Try
        End Function

    End Class
End Namespace